cmake_minimum_required(VERSION 3.18...3.30)#要求最小版本，后面解释下

project(hello-world VERSION 1.22.1 LANGUAGES CXX )#项目名称-cmake生成的那些文件会记录

add_executable(main main.cpp m.hpp)# 最终程序及源文件

add_executable(test test.cpp)



# 设置该目标的输出目录属性
set_target_properties(main PROPERTIES
    RUNTIME_OUTPUT_DIRECTORY "/exe/"
)

install(TARGETS main test DESTINATION /exe/ ) # 这里如果不输入或者.开头默认前缀目录是/usr/local

# 打印 默认安装路径
message(STATUS "CMAKE_INSTALL_PREFIX:" ${CMAKE_INSTALL_PREFIX})
#版本
message(STATUS "PROJECT_VERSION: ${PROJECT_VERSION}")
message(STATUS "PROJECT_VERSION_MAJOR: ${PROJECT_VERSION_MAJOR}")
message(STATUS "PROJECT_VERSION_MINOR: ${PROJECT_VERSION_MINOR}")
message(STATUS "PROJECT_VERSION_PATCH: ${PROJECT_VERSION_PATCH}")
# 目录
message(STATUS "CMAKE_SOURCE_DIR: ${CMAKE_SOURCE_DIR}")
message(STATUS "CMAKE_BINARY_DIR: ${CMAKE_BINARY_DIR}")
message(STATUS "PROJECT_SOURCE_DIR: ${PROJECT_SOURCE_DIR}")
message(STATUS "PROJECT_BINARY_DIR: ${PROJECT_BINARY_DIR}")


# 输出当前的 CMAKE_INSTALL_PREFIX
message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")
# 输出当前的 CMAKE_INSTALL_BINDIR
message(STATUS "CMAKE_INSTALL_BINDIR: ${CMAKE_INSTALL_BINDIR}")


message(STATUS "include 测试：")

# 打印 当前正在执行的源代码目录--- 也就是CMakeLists.txt所在的目录
message(STATUS "CMAKE_CURRENT_SOURCE_DIR:" ${CMAKE_CURRENT_SOURCE_DIR})
# 打印 当前正在执行的cmake 脚本的 完整名称
message(STATUS "CMAKE_CURRENT_LIST_FILE:" ${CMAKE_CURRENT_LIST_FILE})
# 打印当前正在执行的cmake 脚本的 全目录
message(STATUS "CMAKE_CURRENT_LIST_DIR:" ${CMAKE_CURRENT_LIST_DIR})




include(./sub/sub.cmake)#替换脚本 相对目录